package com.yjt.fresh.adpater;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yjt.fresh.R;
import com.yjt.fresh.bean.BeanStoreCoupon;
import com.yjt.fresh.widget.CouponView;

import java.util.List;

import butterknife.BindView;

/**
 * 优惠券中心适配器
 * Created by mcc on 2018/6/10.
 */

public class AdpRvAtyCouponForPay extends BaseQuickAdapter<BeanStoreCoupon, BaseViewHolder> {
    public AdpRvAtyCouponForPay(int layoutResId, @Nullable List<BeanStoreCoupon> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanStoreCoupon item) {

        CheckBox mCb=helper.getView(R.id.cbAppAtyMyCoupon);

        TextView mTvMoney=helper.getView(R.id.tv_app_recycle_item_aty_my_coupon_money);

        TextView mTvUnit=helper.getView(R.id.tv_app_recycle_item_coupon_money_unit);

        TextView mTvContent=helper.getView(R.id.tvAppAtyMyCouponContent);

        TextView mTvType=helper.getView(R.id.tvAppAtyMyCouponType);

        TextView mTvTime=helper.getView(R.id.tvAppAtyMyCouponTime);

        TextView mTvStatus=helper.getView(R.id.tvAppAtyMyCouponStatus);

        mCb.setVisibility(View.VISIBLE);

        mCb.setChecked(item.isCheck());
        mTvStatus.setVisibility(View.GONE);

        if ("1".equals(item.getCOUPONTYPE())){
            mTvUnit.setVisibility(View.VISIBLE);
            mTvMoney.setText(item.getCOUPON_REDUCE_MONEY()+"");
        }else if ("2".equals(item.getCOUPONTYPE())){
            mTvUnit.setVisibility(View.GONE);
            mTvMoney.setText((item.getDISCOUNT()*10)+"折");
        }

        mTvContent.setText("【满"+item.getCOUPON_FULL_MONEY()+"元使用】");

        mTvType.setText(item.getTITLE());
        mTvTime.setText(item.getCOUPON_START_DATE()+"至"+item.getCOUPON_END_DATE());

    }
}
